#!/usr/bin/env python
# -*- coding:utf-8 -*-
# author:凉柠
# datetime:2022/9/7 01:43
# software: PyCharm
import json
import subprocess
import requests

phoneNum = '输入自己注册的账号'
password = '输入正确密码，自己创建'

cmd = fr"node D:\code\spider\project\1_红人点集登录.js {phoneNum} {password}"
pro = subprocess.run(cmd, stdout=subprocess.PIPE)
_sig = pro.stdout
sig = _sig.decode().strip().split("\n")

url = 'https://user.hrdjyun.com/wechat/phonePwdLogin'
headers = {
    'Content-Type': 'application/json',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36',
}
session = requests.session()
session.headers = headers
data = {
    # 'phoneNum':phoneNum,
    # 'pwd': sig[0],
    "phoneNum":phoneNum,
    'pwd':sig[0],
    'sig':sig[1],
    't':sig[2],
    'tenant' : '1'
}
response = session.post(url=url,data=json.dumps(data)).json()

print(response)